-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Make toolbox & flyout properly focusable. #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Make toolbox & flyout properly focusable. #225
Conversation
The toolbox already had a tab stop, but it wouldn't become properly enabled for keyboard navigation. Now it is properly enabled and works when focused both via tab navigation and with the 'T' shortcut.
|
@RoboErikG PTAL for approval. @rachel-fenichel could you PTAL for the behavior in the video to make sure it looks good? I plan to ask @microbit-matt-hillsdon to take a look at this once it's merged, as well, to ensure it has good compatibility with MakeCode's toolbox. |
|
TODO: Self, double check if |
|
Interestingly this changes the behaviour for #222 and the flyout now switches from Variables to the first category after creating a variable. We're a little worried this one might be hard for us to integrate ahead of user testing due to the toolbox interactions and we don't want to lose the ability to take other changes. We'll explore that today and get back to you. |
We've since done a test merge of this change and it's neutral from the perspective of the MakeCode toolbox. I was hopeful that if the flyout learnt to take focus we could simplify some of what we've done there. At the moment when we hand off from the MakeCode toolbox to the flyout (right arrow) we DOM focus the workspace and call navigation.focusFlyout so that we have working keyboard nav in the flyout. It feels weird to me to see a focus outline on the workspace due to that. Long term I was hoping that could just be us calling focus on the flyout. I think it could be useful for us to discuss the MakeCode toolbox hack we have now in the light of the plan on #142. |
|
I'm not sure I understand the keyboard navigation pieces enough yet to do a quick review. Reassigning in case there's time pressure to get this in. |
rachel-fenichel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me logically.
In the screencast I see that the text on all blocks in the flyout is highlighted as though selected. Please fix.
This really helps with the route to the MakeCode sim and matches the behaviour on RaspberryPiFoundation#225
Conflicts: src/navigation_controller.ts
Thanks for checking @microbit-matt-hillsdon. Just to clarify: is there anything else you specifically need here ahead of the user test, or do you think the changes here are sufficient & compatible? Re: the focus outline, I agree completely. It's confusing that the toolbox can hold focus but the workspace be receiving input and vice versa (both of which states are now made possible with this PR). The planned changes in #142 should fix that, though there will need to be a fair amount of reworking of the plugin to rely more on focus and less on presuming focus (i.e. Blockly elements need to actually have focus not just the indicator), but that's expected as part of the broader focus work. |
This helps to verify subcategory behavior (which has been observed as not completely working currently).
BenHenning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed latest changes.
Thanks @rachel-fenichel. PTAL.
rachel-fenichel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for simplifying out the flyout case for now--please also file a bug to follow up on the flyout case, if we don't already have one.
There's nothing further we need here, thanks. If it is going to be merged before UT then the sooner the better from our point of view. We can live without it if needed just because the MakeCode toolbox already had these behaviours (and we've aligned them where this PR differed). |
This really helps with the route to the MakeCode sim and matches the behaviour on RaspberryPiFoundation#225
Conflicts: src/navigation_controller.ts
|
Thanks @rachel-fenichel. I followed up with a fix for the monkey patch installation--any concerns? It seems a bit awkward to me due to how early in the application lifecycle it needs to be 'installed'. Re two earlier comments:
|
|
"the flyout case" meaning the case that there is a flyout with no toolbox. |
Conflicts: src/navigation_controller.ts
It seems possible now to call hide() earlier than previously expected (i.e. when there's a cursor but no current node, such as in the case of focusing the toolbox before the workspace as this PR now makes possible).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed latest changes.
@rachel-fenichel thanks for the extra details on the text issue. It seems that it mysteriously went away after syncing to latest, so that's fun. :) If you could, PTAL at the latest changes just to make sure everything seems reasonable. I've enabled auto-merge so feel free to merge this, as well, if there are no follow-ups. The first video in the description has also been updated accordingly.
Dismissing so that I can enable auto-merge.
|
Hmm GitHub is very mysterious. I apparently don't need to get re-approval after dismissing approval to merge. Well, please go ahead and merge this upon approval if it looks good @rachel-fenichel otherwise I will tomorrow AM. |
|
Changes LGTM. |
* feat: Make toolbox & flyout properly focusable. The toolbox already had a tab stop, but it wouldn't become properly enabled for keyboard navigation. Now it is properly enabled and works when focused both via tab navigation and with the 'T' shortcut. * chore: address reviewer comments * feat: add subcategory to demo toolbox categories This helps to verify subcategory behavior (which has been observed as not completely working currently). * Address reviewer comment for monkey patch install. * Revert monkeypatch installation changes. * Add fix for null current node. It seems possible now to call hide() earlier than previously expected (i.e. when there's a cursor but no current node, such as in the case of focusing the toolbox before the workspace as this PR now makes possible).

Fixes #180
Fixes #149
Fixes part of #101
The toolbox already had a tab stop, but it wouldn't become properly enabled for keyboard navigation. Now it is properly enabled and works when focused both via tab navigation and with the 'T' shortcut.
This has fairly substantial behavioral differences now:
From a long-term perspective, we may want to:
Separately, note that:
The new behavior can be seen here:
Screen.recording.2025-03-11.4.59.00.PM.webm
Note that the specific behaviors to observe are around how tabbing to the toolbox allows it to be focused and have keyboard navigation enabled. The video also demonstrates some of the awkward behaviors of switching focus between the toolbox and workspace when the other one is actually focused (such as when inserting a block from a focused toolbox or using the 't' command from an active workspace).
Note that this video also shows how subcategories are currently a bit buggy with left/right navigation (an existing issue now being tracked in #241):
Screen.recording.2025-02-24.4.34.35.PM.webm